#include <algorithm>
#include <cstdio>
using namespace std;

const int kMaxN = (int)1e6 + 10;

int a[kMaxN], sum[kMaxN];

int main() {
  int n, k;
  int ans = 0;

  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    sum[i] = sum[i - 1] + a[i];
  }
  for (int i = k + 1; i <= n; i++) {
    ans = max(ans, sum[i] - sum[i - (k + 1)]);
  }
  printf("%d\n", ans);
  return 0;
}